package com.youkeyi.ddy.cloud.common.api.application.business.crm.customer;

import com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.dto.BusinessCustomerDetailCloudDto;
import com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.dto.BusinessCustomerListCloudDto;
import com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.dto.BusinessCustomerSameDayListCloudDto;
import com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.param.*;
import com.youkeyi.ddy.cloud.common.api.application.system.user.dto.SystemUserDetailCloudDto;
import com.youkeyi.ddy.cloud.common.response.ResponseContent;
import io.swagger.annotations.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * 系统客户
 *
 * @author  liuxiawang
 * @Date 5/24/22 10:36 PM
 * @Location shenzhen.china
 */
@Api(tags = {"【BUSINESS】customer management"})
@RestController
@FeignClient(value = "YOUKEYI-DDY-CLOUD-APPLICATION-BUSINESS", fallback = BusinessCustomerCloudServiceFallback.class)
@RequestMapping("/business/customer")
public interface BusinessCustomerCloudService {

    // 查询客户列表
    @ApiOperation(value = "Query Business Customer List", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.BusinessCustomerCloudService.list")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = BusinessCustomerListCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Query Business Customer List", dataType = "BusinessCustomerListCloudParam", dataTypeClass = BusinessCustomerListCloudParam.class),
    })
    @GetMapping
    public abstract BusinessCustomerListCloudDto list(BusinessCustomerListCloudParam param);

    // 导出客户列表
    @ApiOperation(value = "Export Business Customer XLS", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.BusinessCustomerCloudService.exportXls")})
    @ApiResponse(code = 200, message = "data Property in Response Body")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Export Business Customer XLS", dataType = "BusinessCustomerListCloudParam", dataTypeClass = BusinessCustomerListCloudParam.class),
    })
    @GetMapping("/export")
    public abstract void exportXls(HttpServletResponse response, BusinessCustomerListCloudParam param);

    // 查询客户详情
    @ApiOperation(value = "Query Business Customer Detail", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.BusinessCustomerCloudService.detail")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = SystemUserDetailCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "customerPrimaryKey", paramType = "path", value = "Param of Query Business Customer Detail", dataType = "String", dataTypeClass = String.class),
    })
    @GetMapping("/{customerPrimaryKey}")
    public abstract BusinessCustomerDetailCloudDto detail(@PathVariable("customerPrimaryKey") String customerPrimaryKey);

    // 查询证件待到期客户
    @ApiOperation(value = "Query Customer Certificate expiration reminder", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.BusinessCustomerCloudService.certificateExpirationReminder")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = BusinessCustomerListCloudDto.class)
    @GetMapping("/certificate/expiration/reminder")
    public abstract BusinessCustomerListCloudDto certificateExpirationReminder();

    // 创建客户
    @ApiOperation(value = "Create Business Customer", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.BusinessCustomerCloudService.create")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Create Business Customer", dataType = "BusinessCustomerCreateCloudParam", dataTypeClass = BusinessCustomerCreateCloudParam.class),
    })
    @PostMapping("/create")
    public abstract ResponseContent create(@RequestBody BusinessCustomerCreateCloudParam param);


    // 转介客户
    @ApiOperation(value = "Refer Business Customer", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.BusinessCustomerCloudService.refer")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Refer Business Customer", dataType = "BusinessCustomerReferCloudParam", dataTypeClass = BusinessCustomerReferCloudParam.class),
    })
    @PostMapping("/refer")
    public abstract ResponseContent refer(@RequestBody BusinessCustomerReferCloudParam param);


    // 编辑客户
    @ApiOperation(value = "Update Business Customer", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.BusinessCustomerCloudService.update")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Update Business Customer", dataType = "BusinessCustomerUpdateCloudParam", dataTypeClass = BusinessCustomerUpdateCloudParam.class),
    })
    @PatchMapping("update")
    public abstract ResponseContent update(@RequestBody BusinessCustomerUpdateCloudParam param);

    // 转让客户
    @ApiOperation(value = "Transfer Business Customer", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.BusinessCustomerCloudService.transfer")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Transfer Business Customer", dataType = "BusinessCustomerTransferCloudParam", dataTypeClass = BusinessCustomerTransferCloudParam.class),
    })
    @PatchMapping("transfer")
    public abstract ResponseContent transfer(@RequestBody BusinessCustomerTransferCloudParam param);

    // 分配客户
    @ApiOperation(value = "Distribute Business Customer", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.BusinessCustomerCloudService.distribute")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Distribute Business Customer", dataType = "BusinessCustomerDistributeCloudParam", dataTypeClass = BusinessCustomerDistributeCloudParam.class),
    })
    @PatchMapping("distribute")
    public abstract ResponseContent distribute(@RequestBody BusinessCustomerDistributeCloudParam param);

    // 删除客户
    @ApiOperation(value = "Delete Business Customer", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.BusinessCustomerCloudService.delete")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Delete Business Customer", dataType = "BusinessCustomerDeleteCloudParam", dataTypeClass = BusinessCustomerDeleteCloudParam.class),
    })
    @DeleteMapping("/delete")
    public abstract ResponseContent delete(BusinessCustomerDeleteCloudParam param);


    // 查询当天新增客户列表
    @ApiOperation(value = "Query Business Customer SameDayList", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.customer.BusinessCustomerCloudService.sameDayList")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = BusinessCustomerSameDayListCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Query Business Customer SameDayList", dataType = "BusinessCustomerListCloudParam", dataTypeClass = BusinessCustomerListCloudParam.class),
    })
    @GetMapping("/same/day/list")
    public abstract BusinessCustomerListCloudDto sameDayList(BusinessCustomerListCloudParam param);

}
